package com.itany.corejava.day14;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class TestIOStream {

    public static void main(String[] args) {


        FileInputStream fis=null;
        FileOutputStream fos=null;

        try {

            fis=new FileInputStream("d:/a.txt");
            fos=new FileOutputStream("d:/b.txt");

            byte[] b=new byte[1024];

            int n;

            while((n=fis.read(b))!=-1){
                fos.write(b,0,n);
            }

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if(fis!=null){
                try {
                    fis.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if(fos!=null){
                try {
                    fos.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }


    }


}
